#include <QWidget>
#include <QApplication>
#include "log4qt/consoleappender.h"
#include "log4qt/logger.h"
#include "log4qt/ttcclayout.h"
#include "log4qt/logmanager.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    // Create a layout
    Log4Qt::LogManager::rootLogger();
    auto p_layout = new Log4Qt::TTCCLayout();
    p_layout->setName(QLatin1String("My Layout"));
    p_layout->activateOptions();

    // Create an appender
    auto p_appender = new Log4Qt::ConsoleAppender(p_layout, Log4Qt::ConsoleAppender::STDOUT_TARGET);
    p_appender->setName(QLatin1String("My Appender"));
    p_appender->activateOptions();

    // Set appender on root logger
    Log4Qt::Logger::rootLogger()->addAppender(p_appender);


    Log4Qt::Logger::logger(QLatin1String("My Logger"))->info("Hello World!");

    QWidget w;
    w.show();

    return a.exec();
}
